﻿/******************************************************************************
 *  All Rights Reserved , Copyright (C) 2012 , EricHu. 
 *  作    者： EricHu
 *  创建时间： 2012-7-20 16:35:52
 ******************************************************************************/
/******************************************************************************
 *  All Rights Reserved , Copyright (C) 2012 , EricHu. 
 *  作    者： EricHu
 *  创建时间： 2012-5-25 9:42:20
 ******************************************************************************/
using System;
using System.Data;

namespace RDIFramework.BusinessEntity
{
    using RDIFramework.Utilities;

    /// <summary>
    /// PiPlatFormAddInEntity
    /// 平台插件实体
    ///
    /// 修改纪录
    ///
    ///		2012-05-25 版本：1.0 EricHu 创建PiPlatFormAddInEntity。
    ///
    /// 版本：1.0
    ///
    /// <author>
    ///		<name>EricHu</name>
    ///		<date>2012-05-25</date>
    /// </author>
    /// </summary>
    [Serializable]
    public class PiPlatFormAddInEntity
    {
        private int? id = null;
        /// <summary>
        /// 主键
        /// </summary>
        public int? Id
        {
            get
            {
                return this.id;
            }
            set
            {
                this.id = value;
            }
        }

        private String guid = string.Empty;
        /// <summary>
        /// 全局唯一标识符(GUID)
        /// </summary>
        public String Guid
        {
            get
            {
                return this.guid;
            }
            set
            {
                this.guid = value;
            }
        }

        private String name = string.Empty;
        /// <summary>
        /// 插件的名称（要做到所见即所得）。
        /// </summary>
        public String Name
        {
            get
            {
                return this.name;
            }
            set
            {
                this.name = value;
            }
        }

        private String assemblyName = string.Empty;
        /// <summary>
        /// dll文件、exe文件等的程序集名称。
        /// </summary>
        public String AssemblyName
        {
            get
            {
                return this.assemblyName;
            }
            set
            {
                this.assemblyName = value;
            }
        }

        private String className = string.Empty;
        /// <summary>
        /// 一般为类的全名(带命名空间)。
        /// </summary>
        public String ClassName
        {
            get
            {
                return this.className;
            }
            set
            {
                this.className = value;
            }
        }

        private byte[] addIn = null;
        /// <summary>
        /// 插件
        /// </summary>
        public byte[] AddIn
        {
            get
            {
                return this.addIn;
            }
            set
            {
                this.addIn = value;
            }
        }

        private long? addInSize = 0;
        /// <summary>
        /// 插件所占的空间大小（以KB为单位）。
        /// </summary>
        public long? AddInSize
        {
            get
            {
                return this.addInSize;
            }
            set
            {
                this.addInSize = value;
            }
        }

        private String version = string.Empty;
        /// <summary>
        /// 版本信息
        /// </summary>
        public String Version
        {
            get
            {
                return this.version;
            }
            set
            {
                this.version = value;
            }
        }

        private String developer = string.Empty;
        /// <summary>
        /// 插件的开发人员（多个以逗号隔开）。
        /// </summary>
        public String Developer
        {
            get
            {
                return this.developer;
            }
            set
            {
                this.developer = value;
            }
        }

        private int? downLoadCount = 0;
        /// <summary>
        /// 下载次数
        /// </summary>
        public int? DownLoadCount
        {
            get
            {
                return this.downLoadCount;
            }
            set
            {
                this.downLoadCount = value;
            }
        }

        private int? deleteMark = 0;
        /// <summary>
        /// 删除标志
        /// </summary>
        public int? DeleteMark
        {
            get
            {
                return this.deleteMark;
            }
            set
            {
                this.deleteMark = value;
            }
        }

        private int? enabled = 1;
        /// <summary>
        /// 有效
        /// </summary>
        public int? Enabled
        {
            get
            {
                return this.enabled;
            }
            set
            {
                this.enabled = value;
            }
        }

        private String description = string.Empty;
        /// <summary>
        /// 插件的描述信息。
        /// </summary>
        public String Description
        {
            get
            {
                return this.description;
            }
            set
            {
                this.description = value;
            }
        }

        private DateTime? createOn = DateTime.Now;
        /// <summary>
        /// 创建日期
        /// </summary>
        public DateTime? CreateOn
        {
            get
            {
                return this.createOn;
            }
            set
            {
                this.createOn = value;
            }
        }

        private String createUserId = string.Empty;
        /// <summary>
        /// 创建用户主键
        /// </summary>
        public String CreateUserId
        {
            get
            {
                return this.createUserId;
            }
            set
            {
                this.createUserId = value;
            }
        }

        private String createBy = string.Empty;
        /// <summary>
        /// 创建用户
        /// </summary>
        public String CreateBy
        {
            get
            {
                return this.createBy;
            }
            set
            {
                this.createBy = value;
            }
        }

        private DateTime? modifiedOn = null;
        /// <summary>
        /// 修改日期
        /// </summary>
        public DateTime? ModifiedOn
        {
            get
            {
                return this.modifiedOn;
            }
            set
            {
                this.modifiedOn = value;
            }
        }

        private String modifyUserId = string.Empty;
        /// <summary>
        /// 修改用户主键
        /// </summary>
        public String ModifyUserId
        {
            get
            {
                return this.modifyUserId;
            }
            set
            {
                this.modifyUserId = value;
            }
        }

        private String modifiedBy = string.Empty;
        /// <summary>
        /// 修改用户
        /// </summary>
        public String ModifiedBy
        {
            get
            {
                return this.modifiedBy;
            }
            set
            {
                this.modifiedBy = value;
            }
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        public PiPlatFormAddInEntity()
        {
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataRow">数据行</param>
        public PiPlatFormAddInEntity(DataRow dataRow)
        {
            this.GetFrom(dataRow);
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataReader">数据流</param>
        public PiPlatFormAddInEntity(IDataReader dataReader)
        {
            this.GetFrom(dataReader);
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataTable">数据表</param>
        public PiPlatFormAddInEntity(DataTable dataTable)
        {
            this.GetFrom(dataTable);
        }

        /// <summary>
        /// 从数据表读取
        /// </summary>
        /// <param name="dataTable">数据表</param>
        public PiPlatFormAddInEntity GetFrom(DataTable dataTable)
        {
            if ((dataTable == null) || (dataTable.Rows.Count == 0))
            {
                return null;
            }

            foreach (DataRow dataRow in dataTable.Rows)
            {
                this.GetFrom(dataRow);
                break;
            }
            return this;
        }

        /// <summary>
        /// 从数据行读取
        /// </summary>
        /// <param name="dataRow">数据行</param>
        public PiPlatFormAddInEntity GetFrom(DataRow dataRow)
        {
            this.Id             = BusinessLogic.ConvertToInt(dataRow[PiPlatFormAddInTable.FieldId]);
            this.Guid           = BusinessLogic.ConvertToString(dataRow[PiPlatFormAddInTable.FieldGuid]);
            this.Name           = BusinessLogic.ConvertToString(dataRow[PiPlatFormAddInTable.FieldName]);
            this.AssemblyName   = BusinessLogic.ConvertToString(dataRow[PiPlatFormAddInTable.FieldAssemblyName]);
            this.ClassName      = BusinessLogic.ConvertToString(dataRow[PiPlatFormAddInTable.FieldClassName]);
            this.AddIn          = BusinessLogic.ConvertToByte(dataRow[PiPlatFormAddInTable.FieldAddIn]);
            this.AddInSize      = BusinessLogic.ConvertToLong(dataRow[PiPlatFormAddInTable.FieldAddInSize]);
            this.Version        = BusinessLogic.ConvertToString(dataRow[PiPlatFormAddInTable.FieldVersion]);
            this.Developer      = BusinessLogic.ConvertToString(dataRow[PiPlatFormAddInTable.FieldDeveloper]);
            this.DownLoadCount  = BusinessLogic.ConvertToInt(dataRow[PiPlatFormAddInTable.FieldDownLoadCount]);
            this.Enabled        = BusinessLogic.ConvertToInt(dataRow[PiPlatFormAddInTable.FieldEnabled]);
            this.DeleteMark     = BusinessLogic.ConvertToInt(dataRow[PiPlatFormAddInTable.FieldDeleteMark]);
            this.Description    = BusinessLogic.ConvertToString(dataRow[PiPlatFormAddInTable.FieldDescription]);
            this.CreateOn       = BusinessLogic.ConvertToDateTime(dataRow[PiPlatFormAddInTable.FieldCreateOn]);
            this.CreateUserId   = BusinessLogic.ConvertToString(dataRow[PiPlatFormAddInTable.FieldCreateUserId]);
            this.CreateBy       = BusinessLogic.ConvertToString(dataRow[PiPlatFormAddInTable.FieldCreateBy]);
            this.ModifiedOn     = BusinessLogic.ConvertToDateTime(dataRow[PiPlatFormAddInTable.FieldModifiedOn]);
            this.ModifyUserId   = BusinessLogic.ConvertToString(dataRow[PiPlatFormAddInTable.FieldModifyUserId]);
            this.ModifiedBy     = BusinessLogic.ConvertToString(dataRow[PiPlatFormAddInTable.FieldModifiedBy]);
            return this;
        }

        /// <summary>
        /// 从数据流读取
        /// </summary>
        /// <param name="dataReader">数据流</param>
        public PiPlatFormAddInEntity GetFrom(IDataReader dataReader)
        {
            this.Id             = BusinessLogic.ConvertToInt(dataReader[PiPlatFormAddInTable.FieldId]);
            this.Guid           = BusinessLogic.ConvertToString(dataReader[PiPlatFormAddInTable.FieldGuid]);
            this.Name           = BusinessLogic.ConvertToString(dataReader[PiPlatFormAddInTable.FieldName]);
            this.AssemblyName   = BusinessLogic.ConvertToString(dataReader[PiPlatFormAddInTable.FieldAssemblyName]);
            this.ClassName      = BusinessLogic.ConvertToString(dataReader[PiPlatFormAddInTable.FieldClassName]);
            this.AddIn          = BusinessLogic.ConvertToByte(dataReader[PiPlatFormAddInTable.FieldAddIn]);
            this.AddInSize      = BusinessLogic.ConvertToLong(dataReader[PiPlatFormAddInTable.FieldAddInSize]);
            this.Version        = BusinessLogic.ConvertToString(dataReader[PiPlatFormAddInTable.FieldVersion]);
            this.Developer      = BusinessLogic.ConvertToString(dataReader[PiPlatFormAddInTable.FieldDeveloper]);
            this.DownLoadCount  = BusinessLogic.ConvertToInt(dataReader[PiPlatFormAddInTable.FieldDownLoadCount]);
            this.Enabled        = BusinessLogic.ConvertToInt(dataReader[PiPlatFormAddInTable.FieldEnabled]);
            this.DeleteMark     = BusinessLogic.ConvertToInt(dataReader[PiPlatFormAddInTable.FieldDeleteMark]);
            this.Description    = BusinessLogic.ConvertToString(dataReader[PiPlatFormAddInTable.FieldDescription]);
            this.CreateOn       = BusinessLogic.ConvertToDateTime(dataReader[PiPlatFormAddInTable.FieldCreateOn]);
            this.CreateUserId   = BusinessLogic.ConvertToString(dataReader[PiPlatFormAddInTable.FieldCreateUserId]);
            this.CreateBy       = BusinessLogic.ConvertToString(dataReader[PiPlatFormAddInTable.FieldCreateBy]);
            this.ModifiedOn     = BusinessLogic.ConvertToDateTime(dataReader[PiPlatFormAddInTable.FieldModifiedOn]);
            this.ModifyUserId   = BusinessLogic.ConvertToString(dataReader[PiPlatFormAddInTable.FieldModifyUserId]);
            this.ModifiedBy     = BusinessLogic.ConvertToString(dataReader[PiPlatFormAddInTable.FieldModifiedBy]);
            return this;
        }
    }
}
